<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	{% block title %}
	<title>天天生鲜-首页</title>
	{% endblock %}
	<link rel="stylesheet" type="text/css" href="/static/myhome/css/reset.css">
	<link rel="stylesheet" type="text/css" href="/static/myhome/css/main.css">
	<script type="text/javascript" src="/static/myhome/js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="/static/myhome/js/jquery-ui.min.js"></script>
	<script type="text/javascript" src="/static/myhome/js/slide.js"></script>
</head>
<body>
	<div class="header_con">
		<div class="header">
			{% if request.session.vipUser  %}
			<div class="welcome fl">欢迎：<a style="color:red" href="{% url 'myhome_order_manage' %}">{{request.session.vipUser.username}}</a>,来到天天生鲜!</div>
			{% endif %}
			<div class="fr">
				<div class="login_info fl">
					欢迎您：<em>张 山</em>
				</div>
				{% if not request.session.vipUser %}
				<div class="login_btn fl">
					<a href="{% url 'myhome_login' %}?paths={{request.path}}&args={{request.GET.dict}}">登录</a>
					<span>|</span>
					<a href="{% url 'myhome_register' %}">注册</a>
				</div>
				{% else %}
				<div class="login_btn fl">
					<a href="{% url 'myhome_logout' %}">退出</a>
				</div>
				{% endif %}
				<div class="user_link fl">
					<span>|</span>
					{% if request.session.vipUser == "" %}
					<a id="a" href="{% url 'myhome_login' %}?paths={% url 'myhome_order_manage' %}">用户中心</a>
					<span>|</span>
					<a id="b" href="{% url 'myhome_login' %}?paths={% url 'myhome_cart_index' %}">我的购物车</a>
					<span>|</span>
					<a id="c" href="{% url 'myhome_login' %}?paths={% url 'myhome_order_order' %}">我的订单</a>

					{% else %}
					<a href="{% url 'myhome_order_manage' %}">用户中心</a>
					<span>|</span>
					<a href="{% url 'myhome_cart_index' %}">我的购物车</a>
					<span>|</span>
					<a href="{% url 'myhome_order_order' %}">我的订单</a>
					{%endif %}
				</div>
			</div>
		</div>		
	</div>
	{%  block shop %}
	<script type="text/javascript">
		$("#a").click(function(){
			alert("请登录！")
		})
		$("#b").click(function(){
			alert("请登录！")
		})
		$("#c").click(function(){
			alert("请登录！")
		})
	</script>
		<div class="search_bar clearfix">
		<a href="{% url 'myhome_index' %}" class="logo fl"><img src="/static/myhome/images/logo.png"></a>
		<div class="search_con fl">
		<form action="{% url 'myhome_goods_list' %}">
			<input type="text" class="input_text fl" name="sou" placeholder="搜索商品">
			<input type="submit" class="input_btn fr" value="搜索" style="text-align: center;">
		</form>
		</div>

	</div>
	{% endblock %}
	{% block main %}


	<div class="navbar_con">
		<div class="navbar">
			<h1 class="fl">全部商品分类</h1>
			<ul class="navlist fl">
				<li><a href="">首页</a></li>
				<li class="interval">|</li>
				<li><a href="">手机生鲜</a></li>
				<li class="interval">|</li>
				<li><a href="">抽奖</a></li>
			</ul>
		</div>
	</div>
	<div class="center_con clearfix">
		<ul class="subnav fl">
			{% for i in cateData %}
			<li><a href="#model0{{i.id}}" class="fruit">{{i.name}}</a></li>
			{% endfor %}
			
		</ul>
		<div class="slide fl">
			<ul class="slide_pics">
				<li><img src="/static/myhome/images/slide.jpg" alt="幻灯片"></li>
				<li><img src="/static/myhome/images/slide02.jpg" alt="幻灯片"></li>
				<li><img src="/static/myhome/images/slide03.jpg" alt="幻灯片"></li>
				<li><img src="/static/myhome/images/slide04.jpg" alt="幻灯片"></li>
			</ul>
			<div class="prev"></div>
			<div class="next"></div>
			<ul class="points"></ul>
		</div>
		<div class="adv fl">
			<a href="#"><img src="/static/myhome/images/adv01.jpg"></a>
			<a href="#"><img src="/static/myhome/images/adv02.jpg"></a>
		</div>
	</div>
	{% for i in cateData %}
	<div class="list_model">
		<div class="list_title clearfix">
			<h3 class="fl" id="model0{{i.id}}">{{i.name}}</h3>
			<div class="subtitle fl">
				<span>|</span>
				{% for ii in i.ad %}
				<a href="{% url 'myhome_goods_list' %}?fen={{i.id}}">{{ii.name}}</a>
				{% endfor %}
			</div>

			<a href="{% url 'myhome_goods_list' %}?fen={{i.id}}" class="goods_more fr" id="fruit_more">查看更多 ></a>

		</div>

		<div class="goods_con clearfix">
			<div class="goods_banner fl"><img src="/static/myhome/images/banner01.jpg"></div>
			<ul class="goods_list fl" style="overflow: hidden;">
				{% for ii in i.ad %}
				<li>
					<h4><a href="#">{{ii.goods_set.all.0.title}}</a></h4>
					<a href="{% url 'myhome_goods_info' %}?id={{ii.goods_set.all.0.id}}"><img src="{{ii.goods_set.all.0.pic_url}}"></a>
					<div class="prize">¥ {{ii.goods_set.all.0.price}}</div>
				</li>
				<li>
					<h4><a href="#">{{ii.goods_set.all.1.title}}</a></h4>
					<a href="{% url 'myhome_goods_info' %}?id={{ii.goods_set.all.1.id}}"><img src="{{ii.goods_set.all.1.pic_url}}"></a>
					<div class="prize">¥ {{ii.goods_set.all.1.price}}</div>
				</li>
				<li>
					<h4><a href="#">{{ii.goods_set.all.2.title}}</a></h4>
					<a href="{% url 'myhome_goods_info' %}?id={{ii.goods_set.all.2.id}}"><img src="{{ii.goods_set.all.2.pic_url}}"></a>
					<div class="prize">¥ {{ii.goods_set.all.2.price}}</div>
				</li>
				<li>
					<h4><a href="#">{{ii.goods_set.all.3.title}}</a></h4>
					<a href="{% url 'myhome_goods_info' %}?id={{ii.goods_set.all.3.id}}"><img src="{{ii.goods_set.all.3.pic_url}}"></a>
					<div class="prize">¥ {{ii.goods_set.all.3.price}}</div>
				</li>
				{% endfor %}
			</ul>
		</div>
	</div>
	{% endfor %}
	{% endblock %}
	<div class="footer">
		<div class="foot_link">
			<a href="#">关于我们</a>
			<span>|</span>
			<a href="#">联系我们</a>
			<span>|</span>
			<a href="#">招聘人才</a>
			<span>|</span>
			<a href="#">友情链接</a>		
		</div>
		<p>CopyRight © 2016 北京天天生鲜信息技术有限公司 All Rights Reserved</p>
		<p>电话：010-****888    京ICP备*******8号</p>
	</div>
	<script type="text/javascript">
		BCSlideshow('focuspic');
		var oFruit = document.getElementById('fruit_more');
		var oShownum = document.getElementById('show_count');

		var hasorder = localStorage.getItem('order_finish');

		if(hasorder)
		{
			oShownum.innerHTML = '2';
		}

		oFruit.onclick = function(){
			window.location.href = 'list.html';
		}
	</script>
</body>
</html>